<?php session_start(); ?>
<?php
 if(!$_SESSION['uname']){
  echo "你没有权限访问此页面!";
  return false;
}
?>
<?php include("../inc/db_config.inc"); ?>
<?php
if(isset($_REQUEST['nid'])&&$_REQUEST['nid']!=""){
    $cata_cid=$_REQUEST['nid'];
}else{
    echo "链接ID不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}
if(isset($_REQUEST['links'])&&$_REQUEST['links']!=""){
    $blog_url=$_REQUEST['links'];
}else{
    echo "博客地址不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}
if(isset($_REQUEST['cata'])&&$_REQUEST['cata']!=""){
    $blog_cata=$_REQUEST['cata'];
}else{
    echo "分类不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}
if(isset($_REQUEST['title'])&&$_REQUEST['title']!=""){
    //$blog_title=$_REQUEST['title'];
    if (get_magic_quotes_gpc()) {
			//$notice_cont = addslashes($_REQUEST['content']);
			$blog_title =  stripslashes(trim($_REQUEST['title']));
		} else {
			$blog_title = trim($_REQUEST['title']);
		}
		$blog_title = str_replace('\'', "''", $blog_title);
}else{
    echo "博客标题不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}
if(isset($_REQUEST['description'])&&$_REQUEST['description']!=""){
    //$blog_desc=$_REQUEST['description'];
    if (get_magic_quotes_gpc()) {
			//$notice_cont = addslashes($_REQUEST['content']);
			$blog_desc =  stripslashes(trim($_REQUEST['description']));
		} else {
			$blog_desc = trim($_REQUEST['description']);
		}
		$blog_desc = str_replace('\'', "''", $blog_desc);
}
$blog_zid=$_REQUEST['z_zid'];
$blog_sid=$_REQUEST['z_sid'];
$blog_ps=$_REQUEST['z_ps'];
$blog_contact=$_REQUEST['contact'];

date_default_timezone_set("Asia/Shanghai"); //北京时间
$post_created=date("Y-m-d H:i:s");
$post_pubid=1;

$result_post=mysql_query("update blogs set title='$blog_title',links='$blog_url',cata='$blog_cata',description='$blog_desc',z_zid='$blog_zid',z_sid='$blog_sid',z_ps='$blog_ps' where id=$cata_cid");
if(mysql_affected_rows()>0){
    //$getID=mysql_insert_id();
    $ref=$_SERVER['HTTP_REFERER'];
    echo "更新成功!页面会在1秒钟后自动返回.<script type='text/javascript'>setTimeout(function(){window.location.href='$ref'},1000)</script>";
}else{
    echo "更新失败!<a href='javascript:history.back()'>返回</a>";
    echo mysql_error();
}
 ?>